package com.lyc.common.repository;

import com.lyc.common.model.BookInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * Created by 廖师兄
 * 2017-05-23 14:29
 */
public interface BookInfoRepository extends JpaRepository<BookInfo, String> {

    Page<BookInfo> findByCategoryIdOrderByBookReadCountDesc(Integer categoryId, Pageable pageable);

    List<BookInfo> findTop50ByBookNameContainsOrderByBookReadCountDesc(String bookName);

    List<BookInfo> findTop50ByBookAuthorLikeOrderByBookReadCountDesc(String bookAuthor);

    List<BookInfo> findByBookIdIn(List<String> bookIdList);

    List<BookInfo> findTop10ByCategoryIdOrderByBookReadCountDesc(Integer categoryId);

    BookInfo findByBookOutId(String bookOutId);
}
